<%--
  @author Kusal Samarakoon
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="s" uri="/struts-tags" %>

<%--<div id="land-registration-module-home-title" class="module-home-title">
    <s:a href="home.do"><img src="${pageContext.request.contextPath}/images/home.png"
                                                        alt="Land Registration"><span><s:label
            value="%{getText('home.label')}"/></span></s:a>

</div>--%>
<script type="text/javascript">
    $(document).ready(function () {
        $('.land-table').dataTable({
            "sPaginationType": "two_button",
            "bShowAll": true
        });
    });
</script>
<div>
    <%--<div class="block-title"><s:label value="%{getText('modify_detail_alienation_application.label')}"/></div>--%>
    <%--<div class="block-data">--%>

    <%--<h2><s:label value="%{getText('detail_alienation_application.label')}"/></h2>--%>

    <table class="width-100 margin-10-auto table land-table">
        <thead>
        <tr>
            <th><s:label value="%{getText('applied_date.label')}"/></th>
            <th><s:label value="%{getText('state.label')}"/></th>
            <th><s:label value="%{getText('edit.label')}"/></th>
        </tr>
        </thead>
        <tbody>
        <s:iterator status="status1" value="landApplicationList">
            <tr>
                <td class="center-align"><s:property value="submitDate"/></td>

                <s:if test="workflowItem != null">
                    <td class="center-align"><s:property value="workflowItem.workflowTask.action"/></td>
                </s:if>
                <s:else>
                    <td class="center-align"><s:property value="initialStatus"/></td>
                </s:else>


                <td class="center-align">
                    <s:if test="initApplicationId ==0">

                        <s:url id="initDetailApplication" action="initDetailApplicationByApplicant">
                            <s:param name="applicationId" value="id"/>
                        </s:url>
                        <s:a href="%{initDetailApplication}" title="%{getText('add_detail_tooltip')}">
                            <img src="<s:url value='/images/detailed-form.png'/>" border="none" width="25"
                                 height="25"/>
                        </s:a>
                    </s:if>
                    <s:else>
                        <%--allow to enter detailed informations on land apps--%>
                        <s:if test="initialStatus == @lk.icta.core.entity.LandApplication.State@INITIAL_APPLICATION_APPROVED ||
                        workflowItem.workflowTask == @lk.icta.core.entity.WorkflowTask@DETAILED_FORM_DATA_ENTRY ||
                        workflowItem.workflowTask == @lk.icta.core.entity.WorkflowTask@DETAILED_FORM_REJECTED">
                            <s:url id="editInitApplication" action="editInitApplicationByApplicant">
                                <s:param name="applicationId" value="id"/>
                                <s:param name="editMode" value="1"/>
                            </s:url>
                            <s:a href="%{editInitApplication}" title="%{getText('edit_tooltip')}">
                                <img src="<s:url value='/images/registration-form.png'/>" border="none" width="25"
                                     height="25"/>
                            </s:a>
                        </s:if>
                        <%--only the detailed apps will be shown with the status--%>
                        <s:elseif test="workflowItem != null">
                            <%--<s:url id="editInitApplication" action="editInitApplicationByApplicant">--%>
                            <s:url id="editInitApplication" action="initDetailApplicationByApplicant">
                                <s:param name="applicationId" value="id"/>
                                <s:param name="searchValue" value="1"/>

                            </s:url>
                            <s:a href="%{editInitApplication}" title="%{getText('edit_tooltip')}">
                                <img src="<s:url value='/images/registration-form.png'/>" border="none" width="25"
                                     height="25"/>
                            </s:a>
                        </s:elseif>
                    </s:else>
                </td>
            </tr>
        </s:iterator>
        </tbody>
    </table>
</div>
<%--
</div>--%>
